package com.time.on.device.screen;

import com.time.on.device.service.TimerService;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class ScreenReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		
		boolean screenOn = false;
		
		if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
			screenOn = false;
		} else {
			if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
				screenOn = true;
			}
		}
		
		Intent i = new Intent(context, TimerService.class);
		i.putExtra("screen_state", screenOn);
		context.startService(i);
	}

}
